<template>
	<view class="content">
		<img class="header" src="@/static/images/appraisalOEM/header.jpg" />
		<view>
			<view class="box-one">
				<view class="one-top">
					<text class="zxjb">在线鉴别</text>

					<view class="desc">
						<text class="border">专业团队</text>
						<text class="border">专业团队</text>
						<text>快速准确</text>
						<img src="@/static/images/appraisalOEM/more.jpg" />
					</view>
				</view>

				<view class="one-center">
					<view class="center-left f1 dis_f_co">
						<span>累计鉴别数</span>
						<view>{{num}}</view>
					</view>
					<view class="center-right f1">鉴别品类
						<img class="classify" src="@/static/images/appraisalOEM/classify.jpg" />
					</view>
				</view>
				<img class="jsjb" @click="go" src="@/static/images/appraisalOEM/jb.jpg" />
			</view>
			<view class="box-two">
				<img @click="go" src="@/static/images/appraisalOEM/auto.jpg" />
				<img @click="go" src="@/static/images/appraisalOEM/jc.jpg" />
			</view>

			<view class="box-three">
				<view class="three-tit">
					<img src="@/static/images/appraisalOEM/tit.jpg" />
					<!-- <view class="more">查看更多</view> -->
					<!-- <u-icon name="arrow-right" color="#999999"></u-icon> -->
				</view>
				<view class="three-list" v-if="list.length > 0">
					<view v-for="(item, i) in list" class="list-item">
						<view class="name">{{item.cate}}
							<text class="xiegang">/</text>
							<text>{{item.subtitle}}</text>
						</view>
						<view class="item-main">
							<img :src="img_src + item.image" />
							<view class="item-desc">
								{{item.title}}
								<view class="tags">{{item.tags}}</view>
								<view class="money">¥
									<text>{{item.price}}</text>
									<view @click="dinggou(item.id)" class="buy">立即订购</view>
								</view>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
		<tabar :active="3" class="tabar" />
	</view>
</template>
<script>
	import tabar from "@/components/tabar.vue";
	export default {
		name: "index",
		components: {
			tabar,
		},
		data() {
			return {
				page: 1,
				total: 0,
				list: [],
				num: 0,
				img_src: this.$.img_src
			};
		},
		onShow() {
			this.get_list()
			this.get_index()
		},
		onReachBottom() {
			if (this.page < this.total) {
				this.page++
				this.get_list()
			}
		},
		methods: {
			dinggou(e){
				console.log(e)
				this.$.ajax(1, "POST", "user/appraisal_goodsorder", {
					gid:e
				}, (res) => {
					this.$.ti_shi(res.msg)
				})
			},
			get_index() {
				this.$.ajax(1, "POST", "index/getjiandingdata", {}, (res) => {
					if (res.code == 1) {
						this.num = res.data.num
					}
				})
			},
			get_list() {
				this.$.ajax(1, "POST", "index/appraisallists", {
					page: this.page
				}, (res) => {
					if (res.code == 1) {
						this.total = res.data.total
						if (this.page == 1) {
							this.list = []
						}
						this.list = [...this.list, ...res.data.list]
					} else {
						this.$.ti_shi(res.msg)
					}
				})
			},
			go() {
				uni.navigateTo({
					url: "/pages/person/myPosts?current=0"
				});
			},
		},
		created() {},
		mounted() {},
	};
</script>
<style lang="scss" scoped>
	.zxjb {
		font-weight: 700;
	}

	.xiegang {
		margin: 0 10rpx;
	}

	.jsjb {
		height: 136rpx;
	}

	.content {
		padding-bottom: 130rpx;

		.box-one {
			padding: 40rpx;
			margin: -10rpx 30rpx 20rpx;
			background-color: #fff;

			.one-top {
				font-size: 30rpx;
				font-weight: 500;
				display: flex;
				align-items: center;
				gap: 20rpx;

				.desc {
					font-size: 22rpx;
					font-weight: 500;
					color: #707070;
					display: flex;
					align-items: center;

					text {
						width: 120rpx;
						text-align: center;
						display: inline-block;
						height: 30rpx;
					}

					img {
						width: 22rpx;
						height: 22rpx;
					}

					.border {
						border-right: 1rpx solid #c9c9c9;
					}
				}
			}

			.one-center {
				display: flex;
				justify-content: space-between;
				padding: 40rpx 0;

				.center-right,
				.center-left {
					font-size: 25rpx;
					font-weight: 500;

					img {
						width: 274rpx;
						height: 96rpx;
						margin-top: 26rpx;
					}

					view {
						display: inline-block;
						font-size: 58rpx;
						font-weight: 500;
						margin-top: 40rpx;
						font-family: fantasy;
						// font-size: 29px;
						// font-weight: 700;
						// line-height: 33.76px;
						// text-align: center;
					}
				}

				.classify {
					width: 618rpx;
					height: 136rpx;
				}
			}
		}

		.box-two {
			padding: 20rpx;
			margin: 0 10rpx 10rpx;
			display: flex;
			align-items: center;
			gap: 30rpx;
			justify-content: space-between;

			img {
				//flex: 1;
				width: 328rpx;
				height: 162rpx;
			}
		}

		.box-three {
			margin: 0 20rpx;

			.three-list {
				padding: 10rpx 20rpx;
				background-color: #fff;
				border-radius: 12rpx;

				.list-item {
					padding: 20rpx 0;
					border-bottom: 1rpx solid #f4f4f4;


					.name {
						font-size: 28rpx;
						font-weight: 700;

						text {
							font-size: 24rpx;
							font-weight: 400;
							color: #999999;
						}
					}

					.item-main {
						margin-top: 30rpx;
						display: flex;
						gap: 10rpx;

						.item-desc {
							flex: 1;
							font-size: 28rpx;
							font-weight: 700;
							display: flex;
							flex-direction: column;
							gap: 10rpx;

							.tags {
								font-size: 20rpx;
								font-weight: 400;
								color: #999999;
							}

							.money {
								display: flex;
								align-items: baseline;
								justify-content: space-between;
								font-size: 20rpx;
								font-weight: 700;

								text {
									flex: 1;
									text-align: left;
									font-size: 28rpx;
								}

								.buy {
									background-color: #3b93ff;
									color: #ffffff;
									width: 144rpx;
									height: 58rpx;
									line-height: 58rpx;
									text-align: center;
									border-radius: 8rpx;
								}
							}
						}

						img {
							width: 144rpx;
							flex-shrink: 0;
							height: 144rpx;
						}
					}
				}

				.list-item:last-child {
					border-bottom: none;
				}
			}

			.three-tit {
				padding: 20rpx;
				display: flex;
				align-items: center;
				justify-content: space-between;
				gap: 10rpx;


				.more {
					flex: 1;
					text-align: right;
					font-size: 24rpx;
					font-weight: 400;
					color: #999999;
				}

				img {
					width: 270rpx;
					height: 60rpx;
				}
			}
		}

		.header {
			height: 300rpx;
		}
	}

	.tabar {
		width: 100%;
		height: 160rpx;
		position: fixed;
		bottom: 0;
		left: 0;
		z-index: 9999;
	}
</style>